import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:fwanandroid/ui/MyColors.dart';
import 'package:fwanandroid/ui/views/CommonAppBar.dart';



class WebPage extends StatefulWidget {

  WebPage({super.key});

  @override
  State<WebPage> createState() => _WebPageState();
}

class _WebPageState extends State<WebPage> {
  @override
  Widget build(BuildContext context) {
    var url = (ModalRoute.of(context)!.settings.arguments as String);
    return Scaffold(
      appBar: CommonAppBar(title: ""),
      body:InAppWebView(
        initialUrlRequest: URLRequest(url: WebUri.uri(Uri.parse(url))),
          shouldOverrideUrlLoading: (controller, navigationAction) async {
            // 允许路由替换
            return NavigationActionPolicy.ALLOW;
          },
      ),
    );
  }
}
